package com.hx.miniblog.config;

import com.hx.miniblog.interceptor.JwtCheckInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;

/**
 * @author wenhao hu
 * @title: WebMvcConfig
 * @projectName miniBlog
 * @description: TODO
 * @date 2021/12/2817:10
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Resource
    private JwtCheckInterceptor jwtCheckInterceptor;

    /**
     * 添加拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(jwtCheckInterceptor).addPathPatterns("/api/**");
    }
}
